/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newpackage;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "RAMATIPOACTI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ramatipoacti.findAll", query = "SELECT r FROM Ramatipoacti r"),
    @NamedQuery(name = "Ramatipoacti.findByCodRamaProceso", query = "SELECT r FROM Ramatipoacti r WHERE r.ramatipoactiPK.codRamaProceso = :codRamaProceso"),
    @NamedQuery(name = "Ramatipoacti.findByCodTipoProceso", query = "SELECT r FROM Ramatipoacti r WHERE r.ramatipoactiPK.codTipoProceso = :codTipoProceso"),
    @NamedQuery(name = "Ramatipoacti.findByCodActividad", query = "SELECT r FROM Ramatipoacti r WHERE r.ramatipoactiPK.codActividad = :codActividad"),
    @NamedQuery(name = "Ramatipoacti.findByDuracion", query = "SELECT r FROM Ramatipoacti r WHERE r.duracion = :duracion")})
public class Ramatipoacti implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected RamatipoactiPK ramatipoactiPK;
    @Column(name = "Duracion")
    private Integer duracion;
    @JoinColumns({
        @JoinColumn(name = "CodRamaProceso", referencedColumnName = "CodRamaProceso", insertable = false, updatable = false),
        @JoinColumn(name = "CodTipoProceso", referencedColumnName = "CodTipoProceso", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Ramatipo ramatipo;

    public Ramatipoacti() {
    }

    public Ramatipoacti(RamatipoactiPK ramatipoactiPK) {
        this.ramatipoactiPK = ramatipoactiPK;
    }

    public Ramatipoacti(short codRamaProceso, int codTipoProceso, int codActividad) {
        this.ramatipoactiPK = new RamatipoactiPK(codRamaProceso, codTipoProceso, codActividad);
    }

    public RamatipoactiPK getRamatipoactiPK() {
        return ramatipoactiPK;
    }

    public void setRamatipoactiPK(RamatipoactiPK ramatipoactiPK) {
        this.ramatipoactiPK = ramatipoactiPK;
    }

    public Integer getDuracion() {
        return duracion;
    }

    public void setDuracion(Integer duracion) {
        this.duracion = duracion;
    }

    public Ramatipo getRamatipo() {
        return ramatipo;
    }

    public void setRamatipo(Ramatipo ramatipo) {
        this.ramatipo = ramatipo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ramatipoactiPK != null ? ramatipoactiPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ramatipoacti)) {
            return false;
        }
        Ramatipoacti other = (Ramatipoacti) object;
        if ((this.ramatipoactiPK == null && other.ramatipoactiPK != null) || (this.ramatipoactiPK != null && !this.ramatipoactiPK.equals(other.ramatipoactiPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "newpackage.Ramatipoacti[ ramatipoactiPK=" + ramatipoactiPK + " ]";
    }
    
}
